<meta title="新建设置" width="800px"/>
<form class="form-horizontal"
      id="settingForm"
      s="form,valid" action="/api/admin/sysSetting" s-valid="{notice: validNotice}"
      style="padding-top: 30px;" method="put">
    <div class="form-group" s-valid-role="item">
        <label class="col-sm-2 control-label">Key：</label>
        <div class="col-sm-10">
            <input type="text" name="name" class="form-control"
                   s-valid-label="Key"
                   s-valid-error="require(),len(2,20)">
        </div>
    </div>
    <div class="form-group" s-valid-role="item">
        <label class="col-sm-2 control-label">值：</label>
        <div class="col-sm-10">
            <input type="text" name="value" class="form-control"
                   s-valid-label="值"
                   s-valid-error="len(0,150)">
        </div>
    </div>
    <div class="form-group" s-valid-role="item">
        <label class="col-sm-2 control-label">备注：</label>
        <div class="col-sm-10">
            <input type="text" name="remark" class="form-control"
                   s-valid-label="备注">
        </div>
    </div>
</form>
<script type="text/javascript">
    S.meta.btns = [
        {
            name: "保存",
            style: "btn btn-primary",
            click: function () {
                return S.S("#settingForm").submit().done(function (rs) {
                    S.close(true);
                    S.notice("新建设置成功", "success");
                });
            }
        },
        {
            name: "关闭",
            style: "btn btn-default",
            click: function () {
                S.close();
            }
        }
    ];

    function validNotice(node, msg, level) {
        if (level == 'error') {
            S.notice(msg, 'danger');
        }
    }
</script>